package com.xinqing.test.LetCode;

/**
 * @Author:CHQ
 * @Date:2021/7/21 9:57
 * @Description
 */
public class IsPalindrome {
    public static void main(String args[]){
        System.out.println(test("A man, a plan, a canal: Panama"));
    }
    public static boolean test(String s){
        StringBuffer sb=new StringBuffer();

        for(char c:s.toCharArray()){
            if(Character.isLetterOrDigit(c)){
                sb.append(Character.toLowerCase(c));
            }
        }
        String res=sb.toString();
        return res.equals(sb.reverse().toString());
    }
}
